﻿@model smartcrm.Models.OrderModel
 
<script src="../../Scripts/orderedit.js"></script>

<div id="divOrder">
    <div id="divOrderContent" style="min-height:240px">          
        @using (Html.BeginForm("","",FormMethod.Post,new {id="form1"}))        {
            <table id="tableEdit" class="font85 tableEdit" style="width:100%">
                <tr>
                    <td class="label" style="width:120px">订单编号</td>
                    <td style="width:200px">
                        @Html.TextBox("OrderNo", null, new { maxlength = "100",@readonly="true" }) 
                     </td>                 
                    <td class="label" style="width:120px">交易日期</td>
                    <td>
                          @Html.TextBox("TransactionDate", null, new { maxlength = "10" }) <span class="redStar">*</span>    
                         @Html.Hidden("TransactionDateStr")   
                     </td>
                </tr> 
                <tr>
                    <td class="label">所属客户</td>
                    <td>
                       @Html.DropDownList("CustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))&nbsp;<span class="redStar">*</span>                        
                       <img onclick='SearchCustomer()' src="../../Images/grid/search.png" style="height:24px;width:24px; vertical-align:middle; cursor:pointer" title="快速搜索" />                  
                    </td>                
                    <td class="label">联系人</td>
                    <td>
                        <select id="ContactNo" name="ContactNo"></select>        
                        @Html.Hidden("hContactNo")                
                        @Html.TextBox("Contact", null, new { maxlength = "100" })
                     </td>
                </tr>               
              
                <tr>
                    <td class="label">订单明细</td>
                    <td colspan="3" class="list">
                        <div class="FR" style="margin-bottom:5px"><input type="button" value="添加明细" id="aAddDetail" onclick="javascript:return addDetail()" /></div>
                        <table id="tdOrderDetail" style="width:100%">
                            <thead>
                            <tr>
                                <th style="width:30%">名称</th>
                                <th  style="width:18%">分类</th>
                                <th  style="width:10%">数量</th>
                                <th  style="width:10%">金额</th> 
                                <th  style="width:10%">加工费</th> 
                                <th  style="width:10%">预计完成</th>                             
                                <th  style="width:12%">操作</th>
                            </tr>  
                            </thead>                           
                        </table>
                    </td>
                </tr>
                  <tr>
                    <td class="label">订单金额</td>
                    <td>
                        @Html.TextBox("totalAmount", null, new { maxlength = "10", @class = "money" })&nbsp;<span class="redStar">*</span>                        
                     </td>
                    <td class="label">加工费</td>
                    <td>@Html.TextBox("totalFactoryAmount", null, new { maxlength = "10", @class = "money" })                     
                    </td>
                </tr>    
                           
            </table>          
        }
    </div>  
    <div style="text-align:right;">  
     <span id="errorMessage" class="errorSpan"></span>    &nbsp;&nbsp;&nbsp;&nbsp;
       <input type="button" id="btnSave" value="保存" />
       <input type="button" id="btnCancel" value="取消" />    
    </div>  
</div>  

<div id="divOrderDetail" title="订单明细信息" style="display:none">      
    <div id="divOrderDetailContent" style="overflow-y: auto; height: 580px;">         
   
        @using (Html.BeginForm("form2"))
        {
            <table id="tableEditDetail" class="font85 tableEdit">
                <tr>
                    <td class="label">名称</td>
                    <td>
                        @Html.TextBox("Content", null, new { maxlength = "100" })&nbsp;<span class="redStar">*</span>                                           
                    </td>
                </tr>
                <tr>
                    <td class="label">分类</td>
                    <td>
                       <select id="Category"></select>
                       <input type="hidden" id="ReportCategory" />
                    </td>
                </tr>                                
                <tr>
                    <td class="label"></td>
                    <td>                        
                        <table id="tableDetail" style="width:100%"></table>
                    </td>
                </tr>                
                <tr>
                     <td class="label">数量</td>
                    <td>
                        @Html.TextBox("Number", null, new { maxlength = "10" })&nbsp;<span class="redStar">*</span>                                           
                    </td>
                </tr>
                <tr>
                    <td class="label">单价</td>
                    <td>
                         @Html.TextBox("Price", null, new {maxlength = "10",@class="money"  })&nbsp;<span class="redStar">*</span>              
                    </td>
                </tr>                    
                <tr>
                    <td class="label">金额</td>
                    <td>
                         @Html.TextBox("Amount", null, new {maxlength = "10",@class="money"  })&nbsp;<span class="redStar">*</span>              
                    </td>
                </tr> 
                 <tr>
                    <td class="label">加工商</td>
                    <td>
                        <div style="float:left">
                            @Html.DropDownList("FactoryNo", new SelectList(Model.DdlFactory, "ItemValue", "ItemText"))
                        </div>
                        <div style="float:left" id="divFactory">
                            &nbsp;&nbsp;单价 @Html.TextBox("FactoryPrice", null, new { maxlength = "10", @class = "money" })     
                            &nbsp;&nbsp;费用 @Html.TextBox("FactoryAmount", null, new { maxlength = "10", @class = "money" })     
                        </div>
                    </td>
                </tr>                   
                <tr>
                    <td class="label">交付日期</td>
                    <td>
                        @Html.TextBox("ExpectDeliveryDate", null, new { maxlength = "50" })                                    
                    </td>
                </tr>               
                <tr>
                    <td class="label">流程</td>
                    <td>
                       @Html.DropDownList("WorkFlowNo", new SelectList(Model.DdlWorkFlow, "ItemValue", "ItemText"),new { @style = "width:265px" })
                       <div id="divWorkFlow" style="margin:5px; display:none">
                       下一步：<select id="WorkFlowStepNo" name="WorkFlowStepNo" style="width:120px"></select> &nbsp;&nbsp;                     
                       经办人：<select id="WorkFlowUserId" name="WorkFlowUserId" style="width:120px"></select>           
                       <input type="hidden" id="isEndPoint" />           
                       </div>
                    </td>
                </tr>               
                <tr>
                    <td class="label">备注</td>
                    <td>
                        @Html.TextArea("Memo", null, new { maxlength = "100" })
                    </td>
                </tr>               
            </table> 
                     
        }
    </div>  
    <div style="text-align:right;">  
    <span id="errorMessageDetail" class="errorSpan"></span>   &nbsp;&nbsp;&nbsp;&nbsp;
       <input type="button" id="btnDetailSave" value="保存"/>
       <input type="button" id="btnDetailCancel" value="取消" />        
       <input type="button" id="btnDetailClose" value="关闭" />            
    </div>  
</div>  

<div id="divSearchCustomer" title="客户搜索" class="tableEdit" style="display:none">      
    <div style="overflow-y: auto; margin-top:20px;  text-align:center">  
        <input type="text" placeholder="请输入客户简称" id="txtCustomer" style="width:200px" />
    </div>
</div>
 
@Html.Hidden("IsAdd")
@Html.Hidden("OrderTemplate")
@Html.Hidden("WorkFlowIsNull")
@Html.Hidden("BackURL")